﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Models;

namespace ShiCaiWang1
{
    public partial class L_Project_initiated : System.Web.UI.Page
    {
        private ProjectBLL bll = new ProjectBLL();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void overCheckBox_CheckedChanged(object sender, EventArgs e)
        {
        }

        protected void Buttonimg_Click(object sender, EventArgs e)
        {
            
        }

        protected void button_submit_Click(object sender, EventArgs e)
        {
            List<string> li = new List<string>();
            //项目名称
            
            li.Add(Request["itemsName"].ToString());
            //筹资金额
            li.Add(Request["TextBox_yuan"].ToString());
            //筹集天数
            li.Add(Request["TextBox_day"].ToString());
            //类型
            li.Add(Request["Labe_Types"].ToString());
            //项目地点
            li.Add(Request["prov"].ToString());//省份或市
            li.Add(Request["city"].ToString());//城市
            //项目封面
            //li.Add(FileUpload1.FileName);
            //视频
            li.Add(Request["TextBox_mp4"].ToString());
            //项目简介
            li.Add(Request["TextBox_Introduction"].ToString());
            //项目详情
            li.Add(Request["ke_statusbar"].ToString());
            //标签
            li.Add(Request["TextBox_tag"].ToString());
            //支付金额
            //li.Add(TextBox_amount.Text);
            //说明图片
            //li.Add(FileUpload2.FileName);
            //限定名额
            li.Add(Request["TextBox_Quota"].ToString());
            //运费
            //li.Add(TextBox_Shipping.Text);
            //回报时间
            li.Add(Request["TextBox_end"].ToString());
            //真实姓名
            //li.Add(TextBox_fourname.Text);
            //所在地
            li.Add(Request["prov1"].ToString());//省份或市
            li.Add(Request["city1"].ToString());//城市
            //移动电话
            //li.Add(TextBox_phone.Text);
            //银行信息
            //li.Add(TextBox_bank.Text);
            //开行支部
            //li.Add(TextBox_branch.Text);
            //开行名称
            //li.Add(TextBox_BranName.Text);
            //银行账号
            //li.Add(TextBox1_banklogin.Text);

            //string fileName = FileUpload1.FileName;//获取上传名称
            //string fileFix = fileName.Substring(fileName.LastIndexOf('.') + 1).ToLower();//获取上传文件后缀名
            //if (fileFix != "png" && fileFix != "jpg" && fileFix != "jpeg" && fileFix != "pic")
            //{
            //    //this.lblMessage.Text = "上传不是图片练习！！！";
            //    Response.Write("<Script> alert('上传失败') </script>");
            //}
            //else
            //{
            //    //FileUpload1.SaveAs(Server.MapPath("." + "//imgaes//" + fileName));
            //    //this.ImageUser.ImageUrl = "~ages/" + fileName;
            //    Response.Write("<Script> alert('上传成功') </script>");
            //    //this.lblMessage.Text = "上传成功";
            //}
        }

        /// <summary>
        /// 添加方法封包
        /// </summary>
        public void Add()
        {
            var project = new ProjectInfo();
            var user = new UserInfo();

            //project.ProjectName = itemsName.Text;
            project.Project_state = "审核中";

            if (project == null)
            {
                Response.Write("<script> alert('添加失败') </script> ");
                return;
            }

            Response.Write("<script> alert('添加成功') </script> ");
            bll.AddProject(project, user);
        }
    }
}